package org.activequant.core.domainmodel.events;

import java.io.Serializable;

import org.activequant.core.types.Currency;

/**
* An OrderEvent subclass. Holds the following associated variable:
* <ul>
* <li>commission(double)</li>
* <li>currency(Currency)</li>
* <li>finalCommissionEvent(boolean )</li>
* </ul>
* And these inherited variables:
* <ul>
* <li>id(Long)</li>
* <li>eventTimeStamp(TimeStamp)</li>
* <li>message(String)</li>
* </ul>
* <br>
* <b>History:</b><br>
*  - [11.12.2007] Created (Mike Kroutikov)<br>
*
*  @author Mike Kroutikov
*/
public final class OrderCommissionEvent extends OrderEvent implements Serializable {

	private static final long serialVersionUID = 5202260737844506678L;
	/**
	 * private double commission;
	 */
	private double commission;
	/**
	 * private Currency currency;
	 */
	private Currency currency;
	/**
	 * private boolean finalCommissionEvent = false;<br/>
	 * this shows whether this is the last/final commission report event. Keep listening till you get that one
	 */
	private boolean finalCommissionEvent = false;
	/**
	 * Total commission applied to this transaction.<br/>
	 * returns the associated commission(double)
	 * @return commission.
	 */
	public double getCommission() {
		return commission;
	}
	/**
	 * Sets total commission.<br/>
	 * sets the associated commission(double) with the given commission(double) 
	 * @param commission value.
	 */
	public void setCommission(double commission) {
		this.commission = commission;
	}
	/**
	 * returns the associated currency(Currency)
	 * @return
	 */
	public Currency getCurrency() {
		return currency;
	}
	/**
	 * sets the associated currency(Currency) with the given currency(Currency)
	 * @param currency
	 */
	public void setCurrency(Currency currency) {
		this.currency = currency;
	}
	/**
	 * returns the associated finalCommissionEvent(boolean)
	 * @return
	 */
	public boolean isFinalCommissionEvent() {
		return finalCommissionEvent;
	}
	/**
	 * sets the associated finalCommissionEvent(boolean) with the given finalCommissionEvent(boolean)
	 * @param finalCommissionEvent
	 */
	public void setFinalCommissionEvent(boolean finalCommissionEvent) {
		this.finalCommissionEvent = finalCommissionEvent;
	}
	/**
	 * returns a String in the form: 
	 * "OrderCompletionEvent: commission=${commission}"
	 */
	public String toString() {
		return "OrderCommissionEvent: commission=" + commission+" " + currency.name();
	}
}